package com.tsd.jxc.buy.dao;

import com.tsd.common.vo.BatchDeleteLogicVo;
import com.tsd.core.vo.PageBean;
import com.tsd.jxc.buy.entity.JxcBuyOrderDetail;
import com.tsd.jxc.buy.entity.JxcBuyOrderDetailExt;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 描述：JxcBuyOrderDetailMapper
 *
 * @author Hillpool
 * @date 2022/07/29 15:01:23
 */
public interface JxcBuyOrderDetailMapper {

    JxcBuyOrderDetail selectByPrimaryKey(Long id);

    JxcBuyOrderDetailExt selectBySid(String sid);

    int deleteByPrimaryKey(Long id);

    int insert(JxcBuyOrderDetail record);

    int insertSelective(JxcBuyOrderDetail record);

    int insertList(@Param("list") List<JxcBuyOrderDetailExt> list);

    int updateByPrimaryKey(JxcBuyOrderDetail record);

    int updateByPrimaryKeySelective(JxcBuyOrderDetail record);

    int updateList(@Param("list") List<JxcBuyOrderDetailExt> list);

    List<JxcBuyOrderDetailExt> selectByEntity(JxcBuyOrderDetailExt record);

    List<JxcBuyOrderDetailExt> selectByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<JxcBuyOrderDetailExt> selectCount1Page(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<JxcBuyOrderDetailExt> selectByParams(@Param("params") Map<String, Object> params);

    int deleteLogicByIdList(BatchDeleteLogicVo logicVo);

    int deleteLogicByOrderList(BatchDeleteLogicVo logicVo);

    List<JxcBuyOrderDetailExt> selectValid4ReturnByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<JxcBuyOrderDetailExt> selectBySids(@Param("sids") List<String> sids);

    int updateInQty(@Param("src_list") List<String> src_list);

    int updateStockQty4BuyInvoice(@Param("invoice_list") List<String> invoice_list);

    int updateSoldStockQty4SaleInvoice(@Param("invoice_list") List<String> invoice_list);

    int updateLockAndSoldQty4Sale(@Param("detail_list") List<String> detail_list);

    int updateStockQty4BuyAudit(@Param("order_list") List<String> order_list);

    int updateSoldStockQty4SaleAudit(@Param("order_detail_list") List<String> order_detail_list);

    int updateInvoiceState(@Param("invoice_list") List<String> invoice_list, @Param("state") Integer state);

    List<JxcBuyOrderDetailExt> selectByOrderSid(@Param("order_sid") String order_sid);

    List<JxcBuyOrderDetailExt> select4SelectByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    int updateCutAmountBySidList(@Param("sid_list") List<String> sid_list);

    List<String> selectSidByOrderSid(@Param("order_sid_list") List<String> order_sid_list);
    //更新一个订单内的分录的基本计量单位的数量
    void updateQty4BaseByBuyOrderSid(@Param("buy_order_sid") String sid);

    List<JxcBuyOrderDetailExt> selectExist4Sale2Buy(@Param("sale_order_list") List<String> sale_order_list, @Param("sale_order_detail_list") List<String> sale_order_detail_list);

    int updateReturnInfo( @Param("buy_order_detail_sid_list") List<String> buy_order_detail_sid_list);
}
